//dungeons_and_princesses_gui.cpp
// Raquel Rhodes     11/6/2011, 11/11/2011, 11/18/2011


#include "dungeons_and_princesses_gui.h"
#include "ui_dungeons_and_princesses_gui.h"
#include "GuiInterface.h"

#include <QTGUI/QMessageBox>
#include <QTGUI/QDialog>
#include <QGraphicsObject>
#include <iostream>
#include <string>
#include <cstdlib>

#include <QtGui/QtGui>
#ifndef QT_NO_OPENGL
#include <QtOpenGL/QtOpenGL>
#endif

Dungeons_and_Princesses_gui::Dungeons_and_Princesses_gui(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Dungeons_and_Princesses_gui)
{
    ui->setupUi(this);

    //initialize main gui interface
    ui->graphicsView_MainWindow->setStyleSheet("background-image: url(./Data/castle-wall1.png);");
    ui->graphicsView_Room->setStyleSheet("background-image: url(./Data/R1.png);");

//    ui->pushButton_surprise_0->setIcon();
    ui->label_characterImage->setStyleSheet("background-image: url(./Data/ranger.png);");
    ui->label_characterImage->setScaledContents(true);
}

Dungeons_and_Princesses_gui::~Dungeons_and_Princesses_gui()
{
    delete ui;
}

void Dungeons_and_Princesses_gui::on_pushButton_character_clicked()
{
    //This is supposed to show message:  Character's Stats
   QMessageBox::information(this, tr("Shows Character Stats"), tr("Armor, Weapons, Attacks, etc."), tr("OK"));
 }

void Dungeons_and_Princesses_gui::on_pushButton_N_clicked()
{
    //This will lead to room in N-direction and will update
    //roomWidget, roomDescription, and N,S,E,W button
    intface->somethingHappened("north");
}

void Dungeons_and_Princesses_gui::on_pushButton_W_clicked()
{
    //This will lead to room in W-direction and will update
    //roomWidget, roomDescription, and N,S,E,W buttons
    intface->somethingHappened("west");
}

void Dungeons_and_Princesses_gui::on_pushButton_S_clicked()
{
    //This will lead to room in S-direction and will update
    //roomWidget, roomDescription, and N,S,E,W buttonsK"));
    intface->somethingHappened("south");
}

void Dungeons_and_Princesses_gui::on_pushButton_E_clicked()
{
    //This will lead to room in E-direction and will update
    //roomWidget, roomDescription, and N,S,E,W buttonsr("OK"));
    intface->somethingHappened("east");
}

void Dungeons_and_Princesses_gui::getInterfaceInstance(GuiInterface *guiIf)
{
    intface = guiIf;
}

//Game updates
void Dungeons_and_Princesses_gui::setRoomImage(std::string roomImg)
{
    //Switch Image()
    QString roomImgText = QString::fromStdString(roomImg);
    ui->graphicsView_Room->setStyleSheet(roomImgText);
}//setRoomImage

void Dungeons_and_Princesses_gui::setTextDesc(QString roomDesc)
{
    ui->textBrowser->clear();
    ui->textBrowser->setText(roomDesc);
    update();
}//setTextDesc

void Dungeons_and_Princesses_gui::setDirections(QString dirText)
{
    ui->textBrowser->setText(dirText);
    update();

   /* QString northText = QString::fromStdString(north);
    northText.append("\n");
    QString southText = QString::fromStdString(south);

    QString eastText = QString::fromStdString(east);
    QString westText = QString::fromStdString(west);

    ui->label_3_textMessages->setText(northText);
    ui->label_3_textMessages->setText(southText);
    ui->label_3_textMessages->setText(eastText);
    ui->label_3_textMessages->setText(westText);
*/
}//setDirections

void Dungeons_and_Princesses_gui::on_pushButton_backpack_clicked()
{
    //Show popup of inventory
    QMessageBox::information(this, tr("Backpack Stuff"),
                             tr("Will show inventory - Dora's Backpack, Backpack:\n UNDER CONSTRUCTION"), tr("OK"));
}

void Dungeons_and_Princesses_gui::on_pushButton_attack_clicked()
{
    //This is supposed to set action: Attack
   QMessageBox::information(this, tr("Attack Button"), tr("Function under construction"), tr("OK"));
}

void Dungeons_and_Princesses_gui::on_pushButton_pickup_clicked()
{
    //Use button to pick up stuff
    QMessageBox::information(this, tr("Pick Something Up"), tr("Function under construction"), tr("OK"));
}
